package com.test.controller;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

import com.test.form.User;



@Controller
public class SimpleFormController {
	private static final Logger logger = LoggerFactory.getLogger(SimpleFormController.class);

	@RequestMapping(value = "/simpleForm1.html", method = RequestMethod.GET)
	public String simpleForm(Model model){
		logger.info("simpleForm");
		
		model.addAttribute(new User());
		
		return "simpleForm";
	}
	
	@RequestMapping(value = "/formoutput.html", method = RequestMethod.POST)
	public void simple(@ModelAttribute User user, Model model){
		logger.info("simple " + user.getUserName() + ", " + user.getEmail());
		model.addAttribute("user", user);
		
	}
}
